extends Spatial


var tscnLightTile=preload("res://prefabs/lightTile/lightTle.tscn")
var materials=[
	preload("res://prefabs/lightTile/material1.tres"),
	preload("res://prefabs/lightTile/material2.tres")
]
var _timer=0
var _changeTime=3
var tiles=[]
export(Array,Color) var colors=[]
var _colorIndex=0
func _ready():
	#生成一堆地板
	for i in range(20):
		for j in range(20):
			var tile=tscnLightTile.instance()
			tiles.append(tile)
			var index=0
			if i%2==j%2:
				index=1
			tile['material/0']=materials[index]
			add_child(tile)
			tile.translation=Vector3((i-10)*2,0,(j-10)*2)
func _process(delta):
#	_timer+=delta
#	if _timer>=_changeTime:
#		_timer=0
#		#改变颜色
#		_colorIndex=1 if _colorIndex==0 else 0
#		materials[0].emission=colors[_colorIndex]
#		materials[1].emission=colors[0 if _colorIndex>0 else 1]
	pass



